-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
six phase motor - inprogress #267
base: master
Are you sure you want to change the base?
Conversation
sixphasePMSM_ode (1).pdf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes a good first impression!
Please reorder the ODE to make it more easily comprehensible.
I guess we would need to decide which level of generality we / you would like to cover with this model.
I_SY_IDX = 3 | ||
CURRENTS_IDX = [0, 1, 2, 3] | ||
CURRENTS = ["i_sd", "i_sq", "i_sx", "i_sy"] | ||
VOLTAGES = ["u_sd", "u_sq", "u_sx", "u_sx"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: last voltage component should be u_sy
state[self.I_SD_IDX], | ||
omega * state[self.I_SQ_IDX], | ||
u_dqxy[0], | ||
state[self.I_SQ_IDX], | ||
omega * state[self.I_SD_IDX], | ||
omega, | ||
u_dqxy[1], | ||
state[self.I_SX_IDX], | ||
omega * state[self.I_SY_IDX], | ||
u_dqxy[2], | ||
state[self.I_SY_IDX], | ||
omega * state[self.I_SX_IDX], | ||
u_dqxy[3] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Order of these regressors is rather unsorted. Please implement the same ordering as in other motors, i.e. group the current components, the voltage components and the current * omega components.
The same reordering must then be applied to the parameter matrix (self._model_constants).
Called internally when the motor parameters are changed or the motor is initialized. | ||
""" | ||
mp = self._motor_parameter | ||
self._model_constants = np.array([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to specify via comment which matrix column belongs to which regressor (please see other motor types for reference).
Returns: | ||
The converted quantities in the dq representation like ''[i_sd, i_sq, i_sx, i_sy, i_s0+, i_s0-]''. | ||
since 2N topology is considered (case where the neutral points are not connected) i_s0+, i_s0- will not be taken into account | ||
""" | ||
t_vsd = 1/ 3 * np.array([ | ||
[1, -0.5, -0.5, 0.5 * np.sqrt(3), -0.5 * np.sqrt(3), 0], | ||
[0, 0.5 * np.sqrt(3), -0.5 * np.sqrt(3), 0.5, 0.5, -1], | ||
[1, -0.5, -0.5, -0.5 * np.sqrt(3), 0.5 * np.sqrt(3), 0], | ||
[0, -0.5 * np.sqrt(3), 0.5 * np.sqrt(3), 0.5, 0.5, -1], | ||
[1, 1, 1, 0, 0, 0], | ||
[0, 0, 0, 1, 1, 1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me this seems inconsistent: the function doc says that i_s0 components will not be considered, but the subsequent matrix computation does still compute them / contains the corresponding lines. I think it should be possible to:
- either get rid of these lines if the definition is to only hold for the 2N topology,
OR - cover the general case, whereas it might as well be desired to simulate a 1N topology.
tp_alphaBetaXY = np.array([ | ||
[cos, sin, 0, 0, 0, 0], | ||
[-sin, cos, 0, 0, 0, 0], | ||
[0, 0, cos, sin, 0, 0], | ||
[0, 0, -sin, cos, 0, 0], | ||
[0, 0, 0, 0, 1, 0] | ||
[0, 0, 0, 0, 0, 1] | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first diagonal block entry has a positive sense of rotation, but the second one should have a negative. (As of now, both are coded the same).
For easier comprehension, I would suggest to define the 2D rotation matrix first as a function T(epsilon), and then compound this 6D rotation matrix from blkdiag[T(epsilon), T(-epsilon), eye(2)].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sense of rotation is still documented in the wrong way here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for your invested time, this is looking very nice already. There are only a few miscellaneous comments I would like you to consider.
u_sd V Direct axis voltage | ||
u_sq V Quadrature axis voltage | ||
u_sx V | ||
u_sx V |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u_sy
[ 0, -mp['r_s'], 0, 0, 0, 1, 0, 0, 0, 0, mp['l_q'], 0, 0], | ||
[-mp['psi_PM'], 0, -mp['r_s'], 0, 0, 0, 1, 0, 0, -mp['l_d'], 0, 0, 0], | ||
[ 0, 0, 0, -mp['r_s'], 0, 0, 0, 1, 0, 0, 0, 0, -mp['l_y']], | ||
[ 0, 0, 0, 0, -mp['r_s'], 0, 0, 0, 1, 0, 0, mp['l_x'], 0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good to me. Good job!
tp_alphaBetaXY = np.array([ | ||
[cos, sin, 0, 0, 0, 0], | ||
[-sin, cos, 0, 0, 0, 0], | ||
[0, 0, cos, sin, 0, 0], | ||
[0, 0, -sin, cos, 0, 0], | ||
[0, 0, 0, 0, 1, 0] | ||
[0, 0, 0, 0, 0, 1] | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sense of rotation is still documented in the wrong way here
t1 = rotation_matrix(epsilon) | ||
t2 = rotation_matrix(-epsilon) | ||
tp_alphaBetaXY = np.block([ | ||
[t1, np.zeros(t1.shape[0],t1.shape[1])], | ||
[np.zeros(t2.shape[0],t2.shape[1]), t2], | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scipy provides a command that should make this snippet more clear
https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.block_diag.html
Development of six phase machines - new feature